//
//  MHNewMemberTableViewCell.m
//  MiaoCircle
//
//  Created by Xuzhengrong on 2018/8/19.
//  Copyright © 2018年 acgera. All rights reserved.
//

#import "MHNewMemberTableViewCell.h"
#import "NSMutableAttributedString+MHMoment.h"
#import "MHCustomItemViewModel.h"
#import "MHMessageNotification.h"

@implementation MHNewMemberTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.contentLable.font = MHMomentContentFont;
    self.createTimeLabel.font = MHRegularFont_12;
    self.nameLable.font = MHRegularFont_14;
    self.attrImage.clipsToBounds = YES;
    // Initialization code
}

-(void)bindViewModel:(MHCustomItemViewModel *)viewModel
{
   MHMessageNotification *model = viewModel.model;
    
    NSMutableAttributedString *textAttr = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"\n加入你的圈子「%@ 」",model.circleTitle]];
    textAttr.yy_font = MHMomentContentFont;
    textAttr.yy_color = MHMomentContentTextColor;
    textAttr.yy_lineBreakMode = NSLineBreakByCharWrapping;
    textAttr.yy_alignment = NSTextAlignmentLeft;
    NSMutableAttributedString   *askedAttr = [[NSMutableAttributedString alloc] initWithString:model.oprtUserName?:@""];
    askedAttr.yy_color = MHMomentScreenNameTextColor;
    askedAttr.yy_font = MHMomentContentFont;
    askedAttr.yy_alignment = NSTextAlignmentLeft;
    [textAttr insertAttributedString:askedAttr atIndex:0];
    [textAttr mh_regexContentWithWithEmojiImageFontSize:16];
    self.nameLable.attributedText = textAttr.copy;
    self.payIcon.hidden = (model.payType != MHCirclPayTypeCharge);
    self.createTimeLabel.text = model.transformTime;
    [self.avterImageView yy_setImageWithURL:[NSURL URLWithString:model.fullOprtUserFace] placeholder:MHDefaultAvatar(MHDefaultAvatarTypeDefualt)];
    
    if(model.fullCoverUrl.length >0)
    {
        [self.attrImage yy_setImageWithURL:[NSURL URLWithString:model.fullCoverUrl] placeholder:MHDefaultAvatar(MHDefaultAvatarTypeDefualt)];
    }
    
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
